home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / source / develop.s < prev    next >
Text File  |  1993-11-11  |  40KB  |  2,045 lines

  1.  
  2. ;rout            ;when this is off, the routine-file will be
  3.             ;assembled, on=testing
  4.             
  5. ;debug            ;when this is on, colors in the background will
  6.             ;show how much time the routine needs.
  7.  
  8. ;ntsctest        ;when this is on, the routineplayer is in ntsc-mode
  9.  
  10. routinemode    equ    1    ;the routinemode !
  11.  
  12.  
  13. ; the first part of the source handles the things that are necessary to
  14. ; show the picture/copper and playing of the routine.
  15. ; the part between the "***" lines is the routine-source.
  16. ; at the bottom of the file, there are the necessary incbin-files who
  17. ; are needed to test the routine.
  18. ; these are saved with "save effect" in videotracker. they are raw
  19. ; data files which can be fonts,pictures,landscapes,vectorobjects
  20. ; etcetra.
  21. ; the incbin-files are put in the "variables" table, in the routine-
  22. ; player-handler
  23. ; the place where it's done can be found by searching for "!!!"
  24.  
  25.  
  26.     opt    a+    ;devpac 3 optimize
  27.     opt    o+
  28.  
  29.     ifd    rout
  30.     ;videotracker routine-test
  31.  
  32.     incdir    "videotracker:include/"
  33.     include    "exec/types.i"
  34.     include    "graphics/gfxbase.i"
  35.     include    "lvo/graphics_lib.i"
  36.     incdir    'videotracker:effect/'
  37.  
  38. vew_wid    equ    44
  39. vew_hgt    equ    290
  40. win_hgt    equ    117
  41. win_str    equ    $1a
  42.  
  43.     SECTION    1,CODE_C
  44. tus
  45.     lea    var,a0
  46.     move.l    #rotsrc,curpic1        ;picture !!!
  47.     move.l    #rotset,var_cols1(a0)    ;colorset !!!
  48.  
  49.  
  50.     move.l    ($4).w,a6
  51.     sub.l    a1,a1
  52.     jsr    -$126(a6)        ;findtask
  53.     move.l    d0,curtsk
  54.     move.l    d0,a0
  55.     move.l    $b8(a0),tskpri
  56.  
  57.     lea    dosnam,a1        ;doslib openen
  58.     moveq.l    #0,d0
  59.     move.l    (4).w,a6
  60.     jsr    -408(a6)        ;openlib
  61.     move.l    d0,doslib
  62.  
  63.     bsr.s    label5            ;videotracker opstarten
  64.     
  65.     move.l    curtsk,a0
  66.     move.l    tskpri,$b8(a0)
  67.     move.l    ($4).w,a6
  68.     jsr    -$84(a6)        ;forbid
  69.  
  70.     move.l    doslib,a1
  71.     move.l    (4).w,a6
  72.     jsr    -414(a6)        ;closelib
  73.  
  74.     moveq.l    #0,d0
  75.     rts
  76.     
  77. label5
  78.     move.l    (4).w,a6        ;workbench gedoe
  79.  
  80.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  81.  
  82.     ifd    ntsctest
  83.     move.b    #60,ntscmode        ;60 hertz (ntsc)
  84.     endc
  85.  
  86.     cmp.b    #50,ntscmode        ;ntsc ?
  87.     beq.s    str.ntsc
  88.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  89. str.ntsc
  90.  
  91.     move.l    (4).w,a6        ;68030 cache off 
  92.     jsr    -120(a6)
  93.  
  94.     btst.b    #1,297(a6)
  95.     beq.s    str.nfc
  96.     lea.l    str.ft,a5
  97.     jsr    -30(a6)
  98. str.nfc
  99.     jsr    -126(a6)
  100.     bra.s    str.fc
  101.     
  102. str.ft
  103.     dc.w    $4e7a,2
  104.     bclr    #0,d0
  105.     bset    #13,d0
  106.     dc.w    $4e7b,2
  107.     rte
  108. str.fc
  109.  
  110.     lea    cprjmp,a2        ;copjmp zetten !
  111.     move.l    #cprbck-8,d0
  112.     move.w    d0,6(a2)
  113.     swap    d0
  114.     move.w    d0,2(a2)
  115.  
  116.     lea    cprbck-8,a2        ;copstr zetten !
  117.     move.l    #cpr,d0
  118.     move.w    d0,6(a2)
  119.     swap    d0
  120.     move.w    d0,2(a2)
  121.  
  122.     bsr    cprsprrem        ;sprites legen
  123.  
  124.     lea    gfxnam,a1        ;graphics lib openen
  125.     move.l    (4).w,a6
  126.     jsr    -408(a6)        ;openlib
  127.     move.l    d0,a6
  128.     move.l    d0,gfxlib
  129.     move.l    38(a6),oldcprlist
  130.  
  131.     bset    #1,$bfe001
  132.     bsr    copbuf            ;copper vullen
  133.  
  134.     bsr    sysoff
  135.  
  136. gadrun
  137.     btst    #6,($bfe001).l
  138.     bne    gadrun
  139.  
  140. scrend
  141. scrend.play
  142.     bsr    syson
  143.  
  144.     move.l    gfxlib,a1
  145.     move.l    (4).w,a6
  146.     jsr    -414(a6)        ;closelib
  147.  
  148. scrend.qb
  149.     moveq.l    #0,d0    
  150.     rts
  151.     
  152.     ;vertical blank interrupt, no blits.
  153.     ;handles counters,interlace,sprite
  154.     ;level 3
  155.  
  156. intvb
  157.     bra.s    intvb.cnt
  158.     dc.l    'VIDU'
  159.     dc.l    'LOOP'
  160. intvb.cnt
  161.     movem.l    d0-d7/a0-a6,-(sp)
  162.     lea    ($dff000).l,a6
  163.  
  164.     move.w    $01e(a6),d0
  165.     btst    #5,d0            ;vblank ?
  166.     bne.s    intvb.vb
  167.  
  168.     bra.s    intcop.end
  169.  
  170. intvb.vb
  171.     bsr    grap
  172.     bsr    palctr            ;palette zetten
  173.     bsr.s    copbuf            ;copper vullen
  174.     
  175. intvb.end
  176.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  177.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  178.     rte
  179.  
  180. intcop.end
  181.     movem.l    (sp)+,d0-d7/a0-a6
  182.     move.l    intvbold,-(sp)
  183.     rts
  184.  
  185.     ;transmission buffer empty routine, BLIT !
  186.     ;handles routines,animations
  187.     
  188. inttbe                    ;tbe interrupt
  189.     movem.l    d0-d7/a0-a6,-(sp)
  190.     lea    ($dff000).l,a6
  191.  
  192.     move.w    $01e(a6),d0
  193.     btst    #0,d0            ;no tbe ?
  194.     beq.s    intdskblk
  195.  
  196.  
  197.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  198.     beq.s    inttbe.cop
  199.     btst    #2,($dff016).l
  200.     beq.s    inttbe.cop
  201.  
  202.     ifd    debug
  203.     move.w    #$700,$dff180
  204.     endc
  205.     
  206.     bsr    rotply            ;routineplayer BLIT !
  207.     bsr.s    copbuf            ;copper vullen
  208.  
  209.     ifd    debug
  210.     move.w    #$070,$dff180
  211.     endc
  212.     
  213. inttbe.cop
  214.  
  215. inttbe.end
  216.     move.w    #$0001,$09c(a6)
  217.     movem.l    (sp)+,d0-d7/a0-a6
  218.     rte
  219.  
  220. intdskblk
  221.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  222.     movem.l    (sp)+,d0-d7/a0-a6
  223.     move.l    inttbeold,-(sp)
  224.     rts
  225.  
  226.  
  227.     ;moves the copperbuffer to the copperlist
  228.     ;sort of double buffering
  229.     
  230. copbuf
  231.     movem.l    d0-d7/a0-a6,-(sp)
  232.  
  233.     lea    ($dff000).l,a6
  234.  
  235. copbuf.novb                ;copperchange overslaan
  236.     moveq.l    #0,d0
  237.     move.b    $005(a6),d0
  238.     lsl.w    #8,d0
  239.     moveq.l    #0,d1
  240.     move.b    $006(a6),d1
  241.     add.w    d1,d0
  242.  
  243.     cmp.w    #$4,d0
  244.     blt    copbuf.novb
  245.  
  246.     cmp.b    #50,ntscmode
  247.     beq.s    copbuf.pal
  248.     cmp.w    #$133-56-8,d0        ;ntsc grens
  249.     bge    copbuf.novb
  250.     bra.s    copbuf.cont
  251. copbuf.pal
  252.     cmp.w    #$133-8,d0        ;pal grens
  253.     bge    copbuf.novb
  254. copbuf.cont
  255.  
  256.     lea    gra.s,a0        ;buffer copieren
  257.     lea    cprbuf,a1
  258.  
  259.     move.w    00*4+2(a0),00*4+2(a1)
  260.     move.w    01*4+2(a0),01*4+2(a1)
  261.     move.w    02*4+2(a0),02*4+2(a1)
  262.     move.w    03*4+2(a0),03*4+2(a1)
  263.     move.w    04*4+2(a0),04*4+2(a1)
  264.     move.w    05*4+2(a0),05*4+2(a1)
  265.     move.w    06*4+2(a0),06*4+2(a1)
  266.     move.w    07*4+2(a0),07*4+2(a1)
  267.     move.w    08*4+2(a0),08*4+2(a1)
  268.     move.w    09*4+2(a0),09*4+2(a1)
  269.  
  270.     move.w    10*4+2(a0),10*4+2(a1)
  271.     move.w    11*4+2(a0),11*4+2(a1)
  272.     move.w    12*4+2(a0),12*4+2(a1)
  273.     move.w    13*4+2(a0),13*4+2(a1)
  274.     move.w    14*4+2(a0),14*4+2(a1)
  275.     move.w    15*4+2(a0),15*4+2(a1)
  276.     move.w    16*4+2(a0),16*4+2(a1)
  277.     move.w    17*4+2(a0),17*4+2(a1)
  278.     move.w    18*4+2(a0),18*4+2(a1)
  279.     move.w    19*4+2(a0),19*4+2(a1)
  280.  
  281.     move.w    20*4+2(a0),20*4+2(a1)
  282.     move.w    21*4+2(a0),21*4+2(a1)
  283.     move.w    22*4+2(a0),22*4+2(a1)
  284.     move.w    23*4+2(a0),23*4+2(a1)
  285.     move.w    24*4+2(a0),24*4+2(a1)
  286.     move.w    25*4+2(a0),25*4+2(a1)
  287.     move.w    26*4+2(a0),26*4+2(a1)
  288.     move.w    27*4+2(a0),27*4+2(a1)
  289.     move.w    28*4+2(a0),28*4+2(a1)
  290.     move.w    29*4+2(a0),29*4+2(a1)
  291.  
  292.     move.w    30*4+2(a0),30*4+2(a1)
  293.     move.w    31*4+2(a0),31*4+2(a1)
  294.     move.w    32*4+2(a0),32*4+2(a1)
  295.     move.w    33*4+2(a0),33*4+2(a1)
  296.     move.w    34*4+2(a0),34*4+2(a1)
  297.     move.w    35*4+2(a0),35*4+2(a1)
  298.     move.w    36*4+2(a0),36*4+2(a1)
  299.     move.w    37*4+2(a0),37*4+2(a1)
  300.     move.w    38*4+2(a0),38*4+2(a1)
  301.     move.w    39*4+2(a0),39*4+2(a1)
  302.  
  303.     move.w    40*4+2(a0),40*4+2(a1)
  304.     move.w    41*4+2(a0),41*4+2(a1)
  305.     move.w    42*4+2(a0),42*4+2(a1)
  306.     move.w    43*4+2(a0),43*4+2(a1)
  307.     move.w    44*4+2(a0),44*4+2(a1)
  308.     move.w    45*4+2(a0),45*4+2(a1)
  309.     move.w    46*4+2(a0),46*4+2(a1)
  310.     move.w    47*4+2(a0),47*4+2(a1)
  311.     move.w    48*4+2(a0),48*4+2(a1)
  312.     move.w    49*4+2(a0),49*4+2(a1)
  313.  
  314.     move.w    50*4+2(a0),50*4+2(a1)
  315.     move.w    51*4+2(a0),51*4+2(a1)
  316.     move.w    52*4+2(a0),52*4+2(a1)
  317.     move.w    53*4+2(a0),53*4+2(a1)
  318.     move.w    54*4+2(a0),54*4+2(a1)
  319.  
  320. copbuf.end
  321.     movem.l    (sp)+,d0-d7/a0-a6
  322.     rts
  323.  
  324.     ;goes back to the workbench
  325.     
  326. syson
  327.     movem.l    d0-d7/a0-a6,-(sp)
  328.  
  329.     move.w    #$0001,$dff09a        ;tbeint uit
  330.     move.l    intvbold,($6c).w
  331.     move.l    inttbeold,($64).w
  332.  
  333.     move.l    4,a6
  334.     jsr    -138(a6)        ;permit
  335.  
  336.     move.l    gfxlib,a6
  337.     jsr    -462(a6)        ;disownblitter
  338.  
  339.     move.l    wbview,a1
  340.     move.l    gfxlib,a6
  341.     jsr    _LVOLoadView(a6)     ; Fix view
  342.     jsr    _LVOWaitTOF(a6)
  343.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  344.  
  345. syson.ras
  346.     cmp.b    #$c0,$dff006        ;prevent copperjump
  347.     bne    syson.ras
  348.  
  349.     move.l    gfxlib,a6
  350.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  351.  
  352.     movem.l    (sp)+,d0-d7/a0-a6
  353.     rts
  354.     
  355.     ;goes back to the gadgetscreen
  356.     
  357. sysoff
  358.     movem.l    d0-d7/a0-a6,-(sp)
  359.      
  360.     move.l    gfxlib,a6
  361.     move.l    gb_ActiView(a6),wbview    ;current view
  362.     sub.l    a1,a1            ; clear a1
  363.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  364.     jsr    _LVOWaitTOF(a6)     ; Wait once
  365.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  366.  
  367.     move.l    gfxlib,a6
  368.     jsr    -456(a6)        ;ownblitter
  369.  
  370.     move.l    4,a6
  371.     jsr    -132(a6)        ;forbid
  372.         
  373.     move.l    ($6c).w,intvbold
  374.     move.l    #intvb,($6c).w
  375.     move.l    ($64).w,inttbeold
  376.     move.l    #inttbe,($64).w
  377.     move.w    #$8001,$dff09a        ;tbeint aan
  378.     bsr    gracpr            ;reset copper
  379.     bsr    copbuf            ;copy copper
  380.     move.l    #cpr,$dff080
  381.  
  382.     movem.l    (sp)+,d0-d7/a0-a6
  383.     rts
  384.     
  385. cprsprrem
  386.     movem.l    d0-d7/a0-a6,-(sp)
  387.     lea    cprspr,a0
  388.     move.l    #sprdat,d0
  389.     move.w    #7,d1
  390. cprsprrem.a
  391.     move.w    d0,3*2(a0)
  392.     swap    d0
  393.     move.w    d0,1*2(a0)
  394.     swap    d0
  395.     add.l    #8,a0
  396.     dbra    d1,cprsprrem.a
  397.     movem.l    (sp)+,d0-d7/a0-a6
  398.     rts
  399.  
  400. varset                    ;variablen neerzetten
  401.     movem.l    d0-d7/a0-a6,-(sp)
  402.     move.l    #var,a0
  403.  
  404.     move.l    #cprbck,var_cprbck(a0)
  405.     move.l    gfxlib,var__GfxBase(a0)
  406.     move.b    ntscmode,var_ntsc(a0)
  407.  
  408.     move.l    curpic1,var_pic1(a0)    ;variabel
  409.     move.l    curpic2,var_pic2(a0)    ;variabel
  410.     move.w    anispd1,var_anispd1(a0)
  411.     move.w    anitel1,var_anitel1(a0)
  412.     movem.l    (sp)+,d0-d7/a0-a6
  413.     rts
  414.     
  415.     ;this routine handles all videotracker-routines
  416.  
  417. rotply    
  418.     movem.l    d0-d7/a0-a6,-(sp)
  419.  
  420.     moveq.l    #0,d0
  421.  
  422.     lea    currot1,a2        ;routine 1
  423.     move.w    rotinf1,d0        ;routine info
  424.     bsr.s    rotplyr
  425.  
  426. rotply.end
  427.     movem.l    (sp)+,d0-d7/a0-a6
  428.     rts
  429.  
  430.     ;this routine handles 1 routine, BLIT !
  431.     
  432. rotplyr
  433.     movem